
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Northwind.Domain.Entities
{
    public partial class Employee : IEntity
    {
        protected static EmployeeBroker broker;
        public static EmployeeBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new EmployeeBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Employee()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected System.Int32? _EmployeeID;
        public System.Int32? EmployeeID
        {
            get{ return _EmployeeID; }
            set{ _EmployeeID=value; }
        }
        
        protected string _LastName;
        public string LastName
        {
            get{ return _LastName; }
            set{ _LastName=value; }
        }
        
        protected string _FirstName;
        public string FirstName
        {
            get{ return _FirstName; }
            set{ _FirstName=value; }
        }
        
        protected string _Title;
        public string Title
        {
            get{ return _Title; }
            set{ _Title=value; }
        }
        
        protected string _TitleOfCourtesy;
        public string TitleOfCourtesy
        {
            get{ return _TitleOfCourtesy; }
            set{ _TitleOfCourtesy=value; }
        }
        
        protected DateTime? _BirthDate;
        public DateTime? BirthDate
        {
            get{ return _BirthDate; }
            set{ _BirthDate=value; }
        }
        
        protected DateTime? _HireDate;
        public DateTime? HireDate
        {
            get{ return _HireDate; }
            set{ _HireDate=value; }
        }
        
        protected string _Address;
        public string Address
        {
            get{ return _Address; }
            set{ _Address=value; }
        }
        
        protected string _City;
        public string City
        {
            get{ return _City; }
            set{ _City=value; }
        }
        
        protected string _Region;
        public string Region
        {
            get{ return _Region; }
            set{ _Region=value; }
        }
        
        protected string _PostalCode;
        public string PostalCode
        {
            get{ return _PostalCode; }
            set{ _PostalCode=value; }
        }
        
        protected string _Country;
        public string Country
        {
            get{ return _Country; }
            set{ _Country=value; }
        }
        
        protected string _HomePhone;
        public string HomePhone
        {
            get{ return _HomePhone; }
            set{ _HomePhone=value; }
        }
        
        protected string _Extension;
        public string Extension
        {
            get{ return _Extension; }
            set{ _Extension=value; }
        }
        
        protected byte[] _Photo;
        public byte[] Photo
        {
            get{ return _Photo; }
            set{ _Photo=value; }
        }
        
        protected string _Notes;
        public string Notes
        {
            get{ return _Notes; }
            set{ _Notes=value; }
        }
        
        protected System.Int32? _ReportsTo;
        public System.Int32? ReportsTo
        {
            get{ return _ReportsTo; }
            set{ _ReportsTo=value; }
        }
        
        protected string _PhotoPath;
        public string PhotoPath
        {
            get{ return _PhotoPath; }
            set{ _PhotoPath=value; }
        }
        
        
        
        // One-To-Many: Orders.EmployeeID  
        protected IList _OrderList;
        public IList OrderList
        {
            get{ return _OrderList; }
            set{ _OrderList=value; }
        }
        
        
                
        
        
        // Many-To-Many: EmployeeTerritories
        protected IList _TerritoryList;
        public IList TerritoryList
        {
            get{ return _TerritoryList; }
            set{ _TerritoryList=value; }
        }
        
        
        #endregion
    }
    
    #region EmployeeBroker

    public partial class EmployeeBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Employee); }
        }
        
        public Employee GetByID(object id)
        {
            return (Employee)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
